Repository navigation
fix(github-ci): HMAC gate fails closed when GITHUB_WEBHOOK_SECRET is unset (#6936) - #8233
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
agent-note:v1 |
|
agent-note:v1 |
Fixes #6936 — queue task 14437, lane code-w. Resumes the uncommitted fix found in the task's existing opencode worktree (same branch), completed with the missing acceptance coverage.
The defect
pkgs/github-ci/worker/src/index.tsverified the webhook HMAC onlyif (secret): withGITHUB_WEBHOOK_SECRETunset or empty (a deploy beforewrangler secret put, a mistyped binding, aworkers_devpreview), every unsigned POST was processed as an authentic GitHub delivery — including the Turso writes behind the gate. The sibling atlas-search Worker fails closed on the same condition; this one failed open, silently.The fix
src/index.ts: the secret check is now unconditional and first. Unset/empty/whitespace secret →console.error(no credential value) + 503 "webhook secret not configured", before the body is read and before any Turso/sink write. Configured behavior is byte-for-byte the old path: valid signature processes, missing/bad signature → 401. GET liveness stays unauthenticated, as the acceptance allows.test/worker.test.ts: parametrized unset/empty cases forworkflow_run(a writing event — rejection asserts 503 + the exact log line, withfetchMocknet-connect disabled andassertNoPendingInterceptors, so any attempted Turso call would fail the test) and forping; plus a wrong-secret 401 case. Thepost()helper now takes the secret (null deletes the binding).README.md: the gate description now states the unconditional fail-closed behavior, so code, header comment ("the HMAC is the gate"), and README agree.Verification
npm test(vitest, workerd): 34/34 pass across 4 files (worker.test.ts 12, incl. the 5 new gate cases).npm run typecheck(tsc --noEmit): clean.Note: the branch base is a few days of main behind (the resumed worktree's base); the diff touches only the three worker files and conflicts with nothing in current main.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.